#include <cstdio>
#include <cstring>

int min( int a, int b ) { return ( a < b ) ?a :b; }

int f[ 2 ][ 101 ][ 1 << 8 ][ 9 ], n, m, a[ 101 ], op;

void init( )
{
    int i;
    op = 0;
    for ( i = 1; i <= n; i++ )
    {
        scanf("%d", &a[ i ]);
        a[ i ] -= 25;
        op |= ( 1 << a[ i ] );
    }
    memset( f, 0x3f, sizeof( f ) );
    f[ 0 ][ 0 ][ 0 ][ 8 ] = 0;
}

int cnt( int t )
{
    int s = 0;
    while ( t )
    {
        s += t % 2;
        t /= 2;
    }
    return s;
}

void work( )
{
    int i, j, k, l, t, p = 1, ans = 10000;
    for ( i = 1; i <= n; i++ )
    {
        for ( j = 0; j <= n; j++ )
            for ( k = 0; k < ( 1 << 8 ); k++ )
                for ( l = 0; l <= 8; l++ )
                    f[ p ][ j ][ k ][ l ] = 0x3f3f3f3f;
        for ( j = 0; j < i && j <= m; j++ )
            for ( k = 0; k < ( 1 << 8 ); k++ )
                for ( l = 0; l <= 8; l++ )
                    if ( f[ p ^ 1 ][ j ][ k ][ l ] != 0x3f3f3f3f )
                    {
                        f[ p ][ j + 1 ][ k ][ l ] = min( f[ p ][ j + 1 ][ k ][ l ], f[ p ^ 1 ][ j ][ k ][ l ] );
                        if ( a[ i ] == l )
                            f[ p ][ j ][ k ][ l ] = min( f[ p ][ j ][ k ][ l ], f[ p ^ 1 ][ j ][ k ][ l ] );
                        else
                            f[ p ][ j ][ k | ( 1 << a[ i ] ) ][ a[ i ] ] = min( f[ p ][ j ][ k | ( 1 << a[ i ] ) ][ a[ i ] ], f[ p ^ 1 ][ j ][ k ][ l ] + 1 ); 
                    }
        p ^= 1;
    }
    p ^= 1;
    for ( i = 0; i <= m; i++ )
        for ( j = 0; j < ( 1 << 8 ); j++ )
            for ( k = 0; k < 8; k++ )
                if ( f[ p ][ i ][ j ][ k ] != 0x3f3f3f3f )
                {
                    t = j ^ op;
                    if ( ans > f[ p ][ i ][ j ][ k ] + cnt( t ) )
                        ans = f[ p ][ i ][ j ][ k ] + cnt( t );
                }
    printf("%d\n", ans);
}

int main( )
{
    int cas = 1;
    while ( scanf("%d%d", &n, &m) )
    {
        if ( n == 0 && m == 0 )
            break;
        printf("Case %d: ", cas++);
        init( );
        work( );
        puts("");
    }
    return 0;
}
